#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
void fun(long long n,int flag)
{
	int arr[1010];
	int i = 0;
	while (n) {
		arr[i++] = n % 16;
		n /= 16;
	}
	if (flag < 0) {
		cout << "-";
	}
	for (int j = i - 1; j >= 0; j--) {
		if (arr[j] >= 0 && arr[j] <= 9) {
			cout << arr[j];
		}
		else if (arr[j] == 10) {
			cout << "A";
		}
		else if (arr[j] == 11) {
			cout << "B";
		}
		else if (arr[j] == 12) {
			cout << "C";
		}
		else if (arr[j] == 13) {
			cout << "D";
		}
		else if (arr[j] == 14) {
			cout << "E";
		}
		else if (arr[j] == 15) {
			cout << "F";
		}
	}
}
int main()
{
	char arr1[20];
	char arr2[20];
	while (cin >> arr1 >> arr2) {
		long long sum1 = 0;
		long long sum2 = 0;
		int count1 = strlen(arr1) - 1;
		int count2 = strlen(arr2) - 1;
		for (int i = 1; i < strlen(arr1); i++) {
			int a = arr1[i] - '0';
			if (arr1[i] == 'A') {
				a = 10;
			}
			if (arr1[i] == 'B') {
				a = 11;
			}
			if (arr1[i] == 'C') {
				a = 12;
			}
			if (arr1[i] == 'D') {
				a = 13;
			}
			if (arr1[i] == 'E') {
				a = 14;
			}
			if (arr1[i] == 'F') {
				a = 15;
			}
			sum1 += a * pow(16,count1-1);
			count1--;
		}
		for (int i = 1; i < strlen(arr2); i++) {
			int a = arr2[i] - '0';
			if (arr2[i] == 'A') {
				a = 10;
			}
			if (arr2[i] == 'B') {
				a = 11;
			}
			if (arr2[i] == 'C') {
				a = 12;
			}
			if (arr2[i] == 'D') {
				a = 13;
			}
			if (arr2[i] == 'E') {
				a = 14;
			}
			if (arr2[i] == 'F') {
				a = 15;
			}
			sum2 += a * pow(16, count2 - 1);
			count2--;
		}
		long long sum = 0;
		if (sum1 == sum2 && arr1[0] == '+' && arr2[0] == '-' || arr1[0] == '-' && arr2[0] == '+') {
			cout << 0 << endl;
			continue;
		}
		if (arr1[0] == '+' && arr2[0] == '-') {
			sum = sum1 - sum2;
		}
		if (arr1[0] == '+' && arr2[0] == '+') {
			sum = sum1 + sum2;
		}
		if (arr1[0] == '-' && arr2[0] == '-') {
			sum = -(sum1 + sum2);
		}
		if (arr1[0] == '-' && arr2[0] == '+') {
			sum = sum2 - sum1;
		}
		bool flag = 1;
		if (sum < 0) {
			flag = 0;
			sum = (-sum);
		}
		fun(sum, flag);
	}
	return 0;
}